package net.omnivention.wulumuqi.html;

import java.util.List;

import net.omnivention.wulumuqi.WuluUtil;

import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.xpath.XPath;

/**
 * @author son
 *
 */
public class HtmlElement extends Element {
	public HtmlElement(String name) {
		super(name);
	}

	public Element selectNode(String xpathExpression)  {	
		List results = selectNodes(xpathExpression);
		return (Element) results.get(0);
	}

	public List selectNodes(String xpathExpression){		
		try {
			XPath xpath = WuluUtil.createXPath(xpathExpression);
			return xpath.selectNodes(this);
		} catch (JDOMException e) {
			throw new RuntimeException(e);
		}
		
	}
}
